/*
 RLRecyclableType.m
 Date Created: February 19, 2010
 
 Author: Karol Krizka <kkrizka@gmail.com>
 
 Copyright (C) 2010 Green-Power
 
 URL: http://code.google.com/p/green-power
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 3 of the License, or
 (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 $Id$
 */

#import "RLRecyclableType.h"


@implementation RLRecyclableType

@synthesize uniqueName;
@synthesize name;
@synthesize variation;
@synthesize depositValue;
@synthesize icon;


+ (NSArray *)listOfficialTypes {
  RLRecyclableType *cans=[[[RLRecyclableType alloc] init] autorelease];
  cans.uniqueName=@"cans";
  cans.icon=@"cans.png";
  cans.name=@"Cans";
  cans.depositValue=5;
  
  RLRecyclableType *clearPlasticSmall=[[[RLRecyclableType alloc] init] autorelease];
  clearPlasticSmall.uniqueName=@"clearPlasticSmall";
  clearPlasticSmall.icon=@"clearPlasticSmall.png";
  clearPlasticSmall.name=@"Clear Plastic";
  clearPlasticSmall.variation=@"Small, <= 1L";
  clearPlasticSmall.depositValue=5;
  
  RLRecyclableType *clearPlasticLarge=[[[RLRecyclableType alloc] init] autorelease];
  clearPlasticLarge.uniqueName=@"clearPlasticLarge";
  clearPlasticLarge.icon=@"clearPlasticLarge.png";
  clearPlasticLarge.name=@"Clear Plastic";
  clearPlasticLarge.variation=@"Large, > 1L";
  clearPlasticLarge.depositValue=20;
  
  RLRecyclableType *pouches=[[[RLRecyclableType alloc] init] autorelease];
  pouches.uniqueName=@"pouches";
  pouches.icon=@"pouches.png";
  pouches.name=@"Pouches";
  pouches.depositValue=5;
  
  RLRecyclableType *tetraPakSmall=[[[RLRecyclableType alloc] init] autorelease];
  tetraPakSmall.uniqueName=@"tetraPakSmall";
  tetraPakSmall.icon=@"tetraPakSmall.png";
  tetraPakSmall.name=@"Tetra Pak";
  tetraPakSmall.variation=@"Small, <= 1L";
  tetraPakSmall.depositValue=5;
  
  RLRecyclableType *tetraPakLarge=[[[RLRecyclableType alloc] init] autorelease];
  tetraPakLarge.uniqueName=@"tetraPakLarge";
  tetraPakLarge.icon=@"tetraPakLarge.png";
  tetraPakLarge.name=@"Tetra Pak";
  tetraPakLarge.variation=@"Large, > 1L";
  tetraPakLarge.depositValue=20;
  
  RLRecyclableType *otherPlasticSmall=[[[RLRecyclableType alloc] init] autorelease];
  otherPlasticSmall.uniqueName=@"otherPlasticSmall";
  otherPlasticSmall.icon=@"otherPlasticSmall.png";
  otherPlasticSmall.name=@"Other Plastic";
  otherPlasticSmall.variation=@"Small, <= 1L";
  otherPlasticSmall.depositValue=5;
  
  RLRecyclableType *otherPlasticLarge=[[[RLRecyclableType alloc] init] autorelease];
  otherPlasticLarge.uniqueName=@"otherPlasticLarge";
  otherPlasticLarge.icon=@"otherPlasticLarge.png";
  otherPlasticLarge.name=@"Other Plastic";
  otherPlasticLarge.variation=@"Large, > 1L";
  otherPlasticLarge.depositValue=20;
  
  RLRecyclableType *gableSmall=[[[RLRecyclableType alloc] init] autorelease];
  gableSmall.uniqueName=@"gableSmall";
  gableSmall.icon=@"gableSmall.png";
  gableSmall.name=@"Gable";
  gableSmall.variation=@"Small, <= 1L";
  gableSmall.depositValue=5;
  
  RLRecyclableType *gableLarge=[[[RLRecyclableType alloc] init] autorelease];
  gableLarge.uniqueName=@"gableLarge";
  gableLarge.icon=@"gableLarge.png";
  gableLarge.name=@"Gable";
  gableLarge.variation=@"Large, > 1L";
  gableLarge.depositValue=20;
  
  RLRecyclableType *glassSmall=[[[RLRecyclableType alloc] init] autorelease];
  glassSmall.uniqueName=@"glassSmall";
  glassSmall.icon=@"glassSmall.png";
  glassSmall.name=@"Glass";
  glassSmall.variation=@"Small, <= 1L";
  glassSmall.depositValue=5;
  
  RLRecyclableType *glassLarge=[[[RLRecyclableType alloc] init] autorelease];
  glassLarge.uniqueName=@"glassLarge";
  glassLarge.icon=@"glassLarge.png";
  glassLarge.name=@"Glass";
  glassLarge.variation=@"Small, <= 1L";
  glassLarge.depositValue=20;
  
  
  NSArray *list=[NSArray arrayWithObjects:cans,
                 clearPlasticSmall,clearPlasticLarge,
                 pouches,
                 tetraPakSmall,tetraPakLarge,
                 otherPlasticSmall,otherPlasticLarge,
                 gableSmall,gableLarge,
                 glassSmall,glassLarge,
                 nil];
  return list;
}

+ (RLRecyclableType *)typeForUniqueName:(NSString *)uniqueName {
  NSArray *types=[RLRecyclableType listOfficialTypes];
  for(RLRecyclableType *type in types) {
    if([type.uniqueName isEqualToString:uniqueName])
      return type;
  }
  
  return nil;
}
@end
